<?php 
header('Cache-Control: no-cache, must-revalidate');
header("Content-type: application/json; charset=utf-8");

session_start();

require_once '../core/conn.php';

$result = 0;

if($_SESSION['is_login'] == 1){
	
	$m = $_REQUEST['m']; 
	$r = 0;
	
	if($m == "d") {
		$id = $_REQUEST['id'];		
		$sql = "delete from users where id=". $id;
		$r = mysql_query($sql);		
	} elseif($m == "e") {
		$id = $_REQUEST['id'];
		$u = $_REQUEST['u'];
		$p = $_REQUEST['p'];
		
		$sql = "update users set u = '$u', p = '$p' where id = $id";
		$r = mysql_query($sql);
		
	} elseif($m == "a") {
		$u = $_REQUEST['u'];
		$p = $_REQUEST['p'];
		
		$sql = "insert into users(u,p) values('$u','$p')";
		$r = mysql_query($sql);		
	}
	
	if($r)
		$result = 1;
	else
		$result = 0;
}



?>
{    
    "result" : "<?=$result?>"
}
